/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "CTA_CONCEPTO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CtaConcepto.findAll", query = "SELECT c FROM CtaConcepto c"),
    @NamedQuery(name = "CtaConcepto.findByMotCod", query = "SELECT c FROM CtaConcepto c WHERE c.motCod = :motCod"),
    @NamedQuery(name = "CtaConcepto.findByMotDesc", query = "SELECT c FROM CtaConcepto c WHERE c.motDesc = :motDesc")})
public class CtaConcepto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "MOT_COD")
    private Short motCod;
    @Column(name = "MOT_DESC")
    private String motDesc;
    @OneToMany(mappedBy = "motCod", fetch = FetchType.LAZY)
    private List<Provision> provisionList;

    public CtaConcepto() {
    }

    public CtaConcepto(Short motCod) {
        this.motCod = motCod;
    }

    public Short getMotCod() {
        return motCod;
    }

    public void setMotCod(Short motCod) {
        this.motCod = motCod;
    }

    public String getMotDesc() {
        return motDesc;
    }

    public void setMotDesc(String motDesc) {
        this.motDesc = motDesc;
    }

    @XmlTransient
    public List<Provision> getProvisionList() {
        return provisionList;
    }

    public void setProvisionList(List<Provision> provisionList) {
        this.provisionList = provisionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (motCod != null ? motCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CtaConcepto)) {
            return false;
        }
        CtaConcepto other = (CtaConcepto) object;
        if ((this.motCod == null && other.motCod != null) || (this.motCod != null && !this.motCod.equals(other.motCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.CtaConcepto[ motCod=" + motCod + " ]";
    }
    
}
